/*
 *  WCMacros.h
 *  WabbitCode
 *
 *  Created by William Towe on 11/22/08.
 *  Copyright 2008 Revolution Software. All rights reserved.
 *
 */

#import <Foundation/Foundation.h>

#define NSKeyedArchivedObject(theObject) [NSKeyedArchiver archivedDataWithRootObject:theObject]
#define NSKeyedUnarchivedData(theData) [NSKeyedUnarchiver unarchiveObjectWithData:theData]

#define NSUserDefaultsKeyedUnarchivedObjectForKey(theKey) [NSKeyedUnarchiver unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] objectForKey:theKey]]
#define NSUserDefaultsBoolForKey(theKey) [[[NSUserDefaults standardUserDefaults] objectForKey:theKey] boolValue] 
#define NSUserDefaultsObjectForKey(theKey) [[NSUserDefaults standardUserDefaults] objectForKey:theKey]
#define NSUserDefaultsUnsignedIntegerForKey(theKey) [[[NSUserDefaults standardUserDefaults] objectForKey:theKey] unsignedIntegerValue]
#define NSUserDefaultsIntegerForKey(theKey) [[[NSUserDefaults standardUserDefaults] objectForKey:theKey] integerValue]

#define NSSetUserDefaultsUnsignedIntegerForKey(theUnsignedInteger,theKey) [[NSUserDefaults standardUserDefaults] setObject:NSNumberWithUnsignedInteger(theUnsignedInteger) forKey:theKey]
#define NSSetUserDefaultsObjectForKey(theObject,theKey) [[NSUserDefaults standardUserDefaults] setObject:theObject forKey:theKey]
#define NSSetUserDefaultsKeyedArchivedObjectForKey(theObject,theKey) [[NSUserDefaults standardUserDefaults] setObject:NSKeyedArchivedObject(theObject) forKey:theKey]
#define NSSetUserDefaultsBoolForKey(theBool,theKey) [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:theBool] forKey:theKey]

#define NSNumberTrue [NSNumber numberWithBool:YES]
#define NSNumberFalse [NSNumber numberWithBool:NO]
#define NSNumberWithFloat(theFloat) [NSNumber numberWithFloat:theFloat]
#define NSNumberWithBool(theBool) [NSNumber numberWithBool:theBool]
#define NSNumberWithUnsignedInteger(theUnsignedInteger) [NSNumber numberWithUnsignedInteger:theUnsignedInteger]
#define NSNumberWithInteger(theInteger) [NSNumber numberWithInteger:theInteger]

#define NSImageNamed(theName) [NSImage imageNamed:(theName)]

#define NSValueWithSize(theSize) [NSValue valueWithSize:(theSize)]

#define NSIntegerValue(theObject) [theObject integerValue]
#define NSBoolValue(theNumber) [theNumber boolValue]
#define NSFloatValue(theNumber) [theNumber floatValue]

#define NSWillChangeValueForKey(theKey) [self willChangeValueForKey:theKey]
#define NSDidChangeValueForKey(theKey) [self didChangeValueForKey:theKey]

#define NSLogObject(theObject) NSLog((@"%@"),(theObject))
#define NSLogRect(theRect) NSLogObject(NSStringFromRect(theRect))
#define NSLogInteger(theInteger) NSLog(@"%u",theInteger)

#define NSLocalizedButtonCancel NSLocalizedString(@"Cancel",@"Cancel")
#define NSLocalizedButtonDone NSLocalizedString(@"Done",@"Done")
#define NSLocalizedButtonOK NSLocalizedString(@"OK",@"OK")
#define NSLocalizedButtonDontSave NSLocalizedString(@"Don't Save",@"Don't Save")
#define NSLocalizedButtonSaveSelected NSLocalizedString(@"Save Selected",@"Save Selected")
#define NSLocalizedButtonSaveAll NSLocalizedString(@"Save All",@"Save All")
#define NSLocalizedButtonSave NSLocalizedString(@"Save",@"Save")
#define NSLocalizedButtonSaveAs [NSString stringWithFormat:NSLocalizedString(@"Save As%C",@"Save As ellipsis"),0x2026]
#define NSLocalizedButtonReSave NSLocalizedString(@"Re-Save",@"Re-Save")
#define NSLocalizedButtonClose NSLocalizedString(@"Close",@"Close")

#define kKeyCodeDelete 0x0033
#define kKeyCodeForwardDelete 0x0075
#define kKeyCodeReturn 0x0024
#define kKeyCodeEnter 0x004c
#define kKeyCodeSpace 0x0031
#define kKeyCodeTab 0x0030
#define kKeyCodeUpArrow 0x007e
#define kKeyCodeDownArrow 0x007d

#define kUnicodeCharacterEllipsis 0x2026
#define kUnicodeCharacterBullet 0x30fb